{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "1\n",
      "2\n",
      "3\n",
      "5\n",
      "8\n",
      "13\n",
      "21\n",
      "34\n",
      "55\n",
      "89\n"
     ]
    }
   ],
   "source": [
    "#求100以内斐波那契数列\n",
    "a=0\n",
    "b=1\n",
    "print (a)\n",
    "print (b)\n",
    "for i in range(5):\n",
    "        a=a+b\n",
    "        b=a+b \n",
    "        print (\"{}\".format(a))\n",
    "        print (\"{}\".format(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "1\n",
      "2\n",
      "3\n",
      "5\n",
      "8\n",
      "13\n",
      "21\n",
      "34\n",
      "55\n",
      "89\n"
     ]
    }
   ],
   "source": [
    "#求100以内斐波那契数列\n",
    "a=0\n",
    "b=1\n",
    "print (a)\n",
    "print (b)\n",
    "for i in range(10):\n",
    "    c=a+b\n",
    "    a=b\n",
    "    b=c\n",
    "    print (\"{}\".format(c))  \n",
    "\n",
    "# 0 1 1 2 3 5 8 \n",
    "# a b c \n",
    "#   a b c \n",
    "#     a b c \n",
    "\n",
    "\n",
    "# 完成的不错，还能用两种方法完成，python的话，可以直接写成，a,b = b, a+b"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
